package zoo;

import java.util.Scanner;

public class J10SungJuk {
	//return을 이용한 메서드
	//주의 : Scanner 클래스를 이용해서 입력처리하고 close()를 하게 되면 **********reopen불가************ 
	
	public static void main(String[] args) {
		String name , result;
		int kor, eng, mat, tot;
		double avg;
		char grd;
		name = inputName(makeScanner());
		kor = inputKor(makeScanner());
		eng = inputEng(makeScanner());
		mat = inputMat(makeScanner());
		tot = getTotal(kor, eng, mat);
		avg = getAverage(tot);
		grd = getGrade(avg);
		
		
		result = name+"의 국어점수는 "+kor+ "점 영어점수는 "+ eng+"점 수학점수는 "+mat+"점"
				+ " \n\t총점은 "+tot+"점 평균점수는 "+avg+"점 학점은 \""+grd+"\"\n\n"; 
		System.out.println(result);
	}//main() END

	private static int inputMat(Scanner sc) {
		int mat;
		System.out.println("수학점수를 입력하세요");
		mat = sc.nextInt();
		closeScanner(sc);
		return mat;
	}

	private static int inputEng(Scanner sc) {
		int eng;
		System.out.println("영어점수를 입력하세요");
		eng = sc.nextInt();
		return eng;
	}

	private static int inputKor(Scanner sc) {
		int kor;
		System.out.println("국어점수를 입력하세요");
		kor = sc.nextInt();
		return kor;
	}

	private static String inputName(Scanner sc) {
		String name;
		System.out.println("이름을 입력하세요");
		name = sc.next();
		return name;
	}
	//Scanner 생성 --**********************************************스캐너 메서드 활용해서 사용
	private static Scanner makeScanner(){
		Scanner sc;
		sc = new Scanner(System.in);
		return sc;
	}
	//Scanner 소멸
	public static void closeScanner(Scanner sc){
		sc.close();
	}
	private static char getGrade(double avg) {
		char grd;
		switch ((int)avg/10) {
		case 10 : grd = '수';break;
		case 9  : grd = '수';break;
		case 8  : grd = '우';break;
		case 7  : grd = '미';break;
		case 6  : grd = '양';break;
		default : grd = '가';break;
		}
		return grd;
	}//getGrade() END

	private static double getAverage(int tot) {
		return (double)tot / 3;
	}//getAverage() END

	private static int getTotal( int kor, int eng, int mat) {
		return kor + eng + mat;
	}//getTotal() END
}//CLASS END
